import json
import os

"""
:param su
"""


def recursion_dir_all_file(root_path, sub_path):
    """
    :param sub_path:
    :param root_path:
    """
    file_list = []
    all_path_and_sub_ok = []
    path = root_path + sub_path
    for dir_path, dirs, files in os.walk(path):
        for file in files:
            file_path = os.path.join(dir_path, file)
            if "\\" in file_path:
                file_path = file_path.replace('\\', '/')

            file_list.append(str(sub_path) + str(file_path.split(str(sub_path))[-1]))
            dict_all_response = {"file_all_path": file_path,
                                 "file_sub_path": str(sub_path) + str(file_path.split(str(sub_path))[-1])}
            all_path_and_sub_ok.append(dict_all_response)
    return all_path_and_sub_ok


if __name__ == '__main__':
    file_list_res = recursion_dir_all_file("D:/tianmingtai/Desktop/4DBev/", "1664276404772")
    print(json.dumps(file_list_res))
